package huaweiExam;

import java.util.Scanner;

public class Test1 {
    //4 1 3 5 2
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String inut = sc.nextLine();
        String[] nums = inut.split(" ");
        try {
            getRes(nums);
        } catch (Exception e) {
            System.out.println("[]");
            return;
        }
        for (int i = 0; i < nums.length; i++) {
            if (i < nums.length - 1) {
                System.out.print(nums[i] + " ");
            } else {
                System.out.print(nums[i]);
            }
        }

    }

    public static void getRes(String[] nums) {
        if (nums == null || nums.length < 2) {
            return;
        }
        for (int i = 1; i < nums.length; i++) {
            if (i % 2 == 1 && Integer.parseInt(nums[i]) > Integer.parseInt(nums[i - 1])) {

                String temp = nums[i];
                nums[i] = nums[i - 1];
                nums[i - 1] = temp;

            }
            if (i % 2 == 0 && Integer.parseInt(nums[i]) < Integer.parseInt(nums[i - 1])) {
                String temp = nums[i];
                nums[i] = nums[i - 1];
                nums[i - 1] = temp;

            }


        }
    }
}
